package com.zx.framework.core.util;

import java.io.File;
import java.util.Calendar;
import java.util.Date;

/**
 * 文件信息
 * 
 * @author stylewolf
 * 
 */
public class FileDetail {

	private String fileName;

	private double size;
	private String realPath;
	private boolean dictionary;
	private Date lastModify;

	private boolean canRead;

	private boolean canWrite;

	private File parent;

	private long freeSpace;

	private long totalSpace;

	private long usableSpace;

	private String showSize;

	public FileDetail(File file) {
		setFileName(file.getAbsolutePath());
		setRealPath(SecurityUtil.encodeBase64(file.getAbsolutePath()));
		setDictionary(file.isDirectory());
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeInMillis(file.lastModified());
		setLastModify(calendar.getTime());
		setSize(file.length());
		setCanRead(file.canRead());
		setCanWrite(file.canWrite());
		setParent(file.getParentFile());
		setFreeSpace(file.getFreeSpace());
		setTotalSpace(file.getTotalSpace());
		setUsableSpace(file.getUsableSpace());
		setShowSize(FileUtil.getShowSize(file.length()));
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public double getSize() {
		return size;
	}

	public void setSize(double size) {
		this.size = size;
	}

	public String getRealPath() {
		return realPath;
	}

	public void setRealPath(String realPath) {
		this.realPath = realPath;
	}

	public boolean isDictionary() {
		return dictionary;
	}

	public void setDictionary(boolean dictionary) {
		this.dictionary = dictionary;
	}

	public Date getLastModify() {
		return lastModify;
	}

	public void setLastModify(Date lastModify) {
		this.lastModify = lastModify;
	}

	public boolean isCanRead() {
		return canRead;
	}

	public void setCanRead(boolean canRead) {
		this.canRead = canRead;
	}

	public boolean isCanWrite() {
		return canWrite;
	}

	public void setCanWrite(boolean canWrite) {
		this.canWrite = canWrite;
	}

	public File getParent() {
		return parent;
	}

	public void setParent(File parent) {
		this.parent = parent;
	}

	public long getFreeSpace() {
		return freeSpace;
	}

	public void setFreeSpace(long freeSpace) {
		this.freeSpace = freeSpace;
	}

	public long getTotalSpace() {
		return totalSpace;
	}

	public void setTotalSpace(long totalSpace) {
		this.totalSpace = totalSpace;
	}

	public long getUsableSpace() {
		return usableSpace;
	}

	public void setUsableSpace(long usableSpace) {
		this.usableSpace = usableSpace;
	}

	public String getShowSize() {
		return showSize;
	}

	public void setShowSize(String showSize) {
		this.showSize = showSize;
	}
}
